﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WorkstationHost.Master" AutoEventWireup="true"
    CodeBehind="ContentRoot.aspx.cs" Inherits="WorkstationDashboard.ContentRoot" %>

<%@ MasterType VirtualPath="~/WorkstationHost.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%--   <link href="css/ui-lightness/jquery-ui-1.8.5.custom.css" type="text/css" rel="Stylesheet" />

    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"
        type="text/javascript"></script>

    <script src="js/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>

    <script src="js/jquery-1.4.1.js" type="text/javascript"></script>
--%>
    <style type="text/css">
        .summaryPanel
        {
        }
        .pieImage
        {
        }
        .linkPanel
        {
        }
    </style>

    <script type="text/javascript">
        var addGroupDialog;
        var processingDlg;
        var processingMsg;
        var headerMessage;

        $(document).ready(function() {
            addGroupDialog = $("#addGroupDialog");
            processingDlg = $("#processingDlg");
            processingMsg = $("#processingMsg");
            headerMessage = $("#headerMessage");
        });

        function addGroup() {
            var name = $("#groupNameInput").val();
            var note = $("#groupNoteInput").val();

            addGroupDialog.dialog("close");
            processingDlg.dialog("open");
            processingMsg.html("Adding Group...");

            PageMethods.AddGroup(name, note, onAddGroupSucceed, onAddGroupFail);
        }

        function onAddGroupSucceed(result) {
            processingMsg.html("Group is added");
            setTimeout(function() {
                processingDlg.dialog("close");
                window.location = window.location;

            }, 2000);
        }

        function onAddGroupFail(error) {
            var errorMsg = error.get_message();
            processingMsg.addClass("ui-state-error");
            processingMsg.html(errorMsg);
        }
    
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <div id="processingDlg">
            <div id="processingMsg" class="ui-state-default">
            </div>
        </div>

        <script type="text/javascript">
            $("#processingDlg").dialog({ autoOpen: false, modal: true });
        </script>

    </div>
    <div class="ui-layout-center">
        <div id="headerMessage" runat="server">
        </div>
        <div>
            <h2>
                Root -
                <asp:Label ID="rootName" runat="server"></asp:Label>
            </h2>
        </div>
        <div>
            <table>
                <tr>
                    <td>
                        <div class="pieImage">
                           
                        </div>
                    </td>
                    <td>
                        <div>
                            <asp:Label ID="okWorkstationCount" runat="server"></asp:Label>
                            Workstations are OK</div>
                        <div>
                            <asp:Label ID="disconnectedWorkstationCount" runat="server"></asp:Label>
                            Workstations are disconnected</div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="ui-layout-east">
        <div>
            <h3>
                Server information</h3>
            <div>
                <div>
                    Database:<br />
                    <asp:Label ID="databaseLabel" runat="server"></asp:Label>
                </div>
                <div>
                    IP address:<br />
                    <asp:Label ID="ipAddressLabel" runat="server"></asp:Label></div>
                <div>
                    Host name<br />
                    <asp:Label ID="hostNameLabel" runat="server"></asp:Label></div>
            </div>
        </div>
        <div>
            <h3>
                Tasks
            </h3>
            <div>
                <div>
                    <a id="addGroupButton" href="#">Add Group...</a>
                    <div id="addGroupDialog" title="Add Group">
                        <div>
                            Group Name:<br />
                            <input id="groupNameInput" type="text" />
                        </div>
                        <div>
                            Group Note:<br />
                            <textarea id="groupNoteInput" cols="25" rows="3"> </textarea>
                        </div>
                    </div>

                    <script type="text/javascript">
                        $("#addGroupDialog").dialog({ autoOpen: false, modal: true,
                            buttons: {
                                Ok: addGroup,
                                Cancel: function() {
                                    $(this).dialog("close");
                                }
                            }
                        });

                        $("#addGroupButton").click(function() {
                            $("#addGroupDialog").dialog("open");
                            return false;
                        });
                    </script>

                </div>
                <div>
                    <a href="AddWorkstation.aspx">Find Workstaions...</a>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
